package com.zxy.study.ui.activity;

import android.os.Bundle;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.zxy.study.R;
import com.zxy.study.ui.widget.BlueCountDownView;

/**
 * @author : Shonn.Zhang
 * @email : shonn.zhang@mart.blue
 * @time : 2020/9/11 17:25
 * @desc :
 */
public class CountDownActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_count_down);

        BlueCountDownView countDownView = findViewById(R.id.view_count_down);
        countDownView.startCountDown(1880878631);

        countDownView.setOnCountDownListener(() -> Toast.makeText(this, "倒计时结束", Toast.LENGTH_SHORT).show());

        findViewById(R.id.btn_start).setOnClickListener(v -> {
            countDownView.startCountDown(10);
        });

        findViewById(R.id.btn_stop).setOnClickListener(v -> {
            countDownView.stopCountDown();
        });

        findViewById(R.id.btn_change_style).setOnClickListener(v -> {
            countDownView.updateStyle(R.drawable.home_bg_red_flashsale_number, R.color.home_countdown_text, R.color.home_colon_red);
        });
    }


}
